<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

let date = 'NNNN-YY-RR'; 




FormatLocaDate(new Date( date + ' UTC '))


 



      function FormatLocaDate(obj){
    var str = '';
    str += obj.getFullYear() + '-';


    if ((obj.getMonth() + 1) < 10) {
      str += '0' + (obj.getMonth() + 1) + '-';
    }else{
      str += (obj.getMonth() + 1) + '-';
    }


    if (obj.getDate() < 10) {
      str += '0' + obj.getDate();
    } else {
      str += obj.getDate();
    }
    return str;
  }


console.log(new Date)
document.write(new Date)
</script>

</html>